#include <pthread.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int data = 0;

void *fun(void *arg)
{
	int *p = (int *)arg;

	*p = 23;
}


int main()
{
	pthread_t tid = 0;
	int ret = 0;
	int *p = NULL;

	p = malloc(sizeof(int));
	memset(p,0,sizeof(int));


	ret = pthread_create(&tid,NULL,fun,p);
	if(ret != 0)
	{
		perror("pthread_create");
		exit(-1);
	}

	pthread_join(tid,NULL);

	printf("data = %d\n",*p);

	return 0;
}


